load("//bazel:mongo_src_rules.bzl", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

mongo_cc_library(
    name = "unified_write_executor",
    srcs = [
        "stats.cpp",
        "unified_write_executor.cpp",
        "write_batch_executor.cpp",
        "write_batch_response_processor.cpp",
        "write_batch_scheduler.cpp",
        "write_op_analyzer.cpp",
        "write_op_batcher.cpp",
        "write_op_producer.cpp",
    ],
    deps = [
        "//src/mongo/db/commands/query_cmd:bulk_write_common",
        "//src/mongo/db/query/write_ops:parsed_update",
        "//src/mongo/s:sharding_router_api",
        "//src/mongo/s:sharding_write_without_shard_key_api",
        "//src/mongo/s/commands/query_cmd:populate_cursor",
        "//src/mongo/s/write_ops:batch_write_types",
        "//src/mongo/s/write_ops:fle",
        "//src/mongo/s/write_ops:pause_migrations_during_multi_updates_enablement",
        "//src/mongo/s/write_ops:sharded_write_ops",
        "//src/mongo/s/write_ops:wc_error",
    ],
)

mongo_cc_unit_test(
    name = "unified_write_executor_test",
    srcs = [
        "unified_write_executor_test.cpp",
        "write_batch_executor_test.cpp",
        "write_batch_response_processor_test.cpp",
        "write_op_analyzer_test.cpp",
        "write_op_batcher_test.cpp",
        "write_op_producer_test.cpp",
    ],
    tags = ["mongo_unittest_first_group"],
    deps = [
        ":unified_write_executor",
        "//src/mongo/db/pipeline/process_interface:mongos_process_interface_factory",
        "//src/mongo/db/shard_role:service_context_non_d",
        "//src/mongo/db/sharding_environment:sharding_mongos_test_fixture",
        "//src/mongo/db/sharding_environment:sharding_test_fixture_common",
        "//src/mongo/s/write_ops:batch_write_types",
    ],
)
